package br.com.sigw.services;

import java.util.HashMap;
import java.util.Map;

import org.hibernate.Criteria;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
import org.hibernate.util.PropertiesHelper;

import br.com.sigw.persistence.HibernateFacadeFactory;
import br.com.sigw.persistence.SessionHandle;
import br.com.sigw.persistence.entitys.Usuario;

import com.sun.org.apache.xml.internal.security.utils.Base64;

public class LoginSP {
	public static void login(Map<String,String> user)throws Exception{ 
		String name = user.get("name");
		String password = user.get("password");
		
		SessionHandle hnd = HibernateFacadeFactory.openSession();
		Criteria crit = hnd.createCriteria(Usuario.class);
		crit.add(Property.forName("NOME").eq(name));
		crit.add(Property.forName("ARQUIVO").eq(password));
		Object ob = crit.uniqueResult();
		System.out.println("foi!");
	}
	
	public static void main(String[] s)throws Exception{
		Map info = new HashMap<String,String>();
		info.put("name", "WENDER");
		info.put("password", "123");
		login(info);
	}
}
